package com.sfzy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sfzy.entity.Certificate;
import com.sfzy.mapper.CertificateMapper;
import com.sfzy.service.CertificateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CertificateServiceImpl implements CertificateService {
    @Autowired
    private CertificateMapper certificateMapper;
    @Override
    public int insertCertificate(Certificate certificate) {
        return certificateMapper.insertCertificate(certificate);
    }

    @Override
    public int deleteCertificate(int id) {
        return certificateMapper.deleteCertificate(id);
    }

    @Override
    public int updateCertificate(Certificate certificate) {
        return certificateMapper.updateCertificate(certificate);
    }

    @Override
    public Certificate selectCertificateById3(int id) {
        return certificateMapper.selectCertificateById3(id);
    }

    @Override
    public PageInfo<Certificate> selectAllCertificates3(Certificate certificate, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Certificate> certificates = certificateMapper.selectAllCertificates3(certificate);
        PageInfo<Certificate> pageInfo = new PageInfo<>(certificates);
        return pageInfo;
    }
}
